package testing.comparer;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import words.Preposition;

import comparer.PrepComparer;


public class PrepComparerTest {

	PrepComparer comparer;
	Preposition origin_prep;
	Preposition compared_prep;

	@Before
	public void setUp() throws Exception {
		this.comparer = new PrepComparer();
		this.origin_prep = new Preposition();
		this.compared_prep = new Preposition();
	}
	@Test
	public void test1()
	{
		String origin = "behind";
		String compare = "behind";
		origin_prep.input(origin);
		compared_prep.input(compare);
		comparer.set_origin(origin_prep);
		comparer.set_compared(compared_prep);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test2()
	{
		String origin = "behind";
		String compare = "since";
		origin_prep.input(origin);
		compared_prep.input(compare);
		comparer.set_origin(origin_prep);
		comparer.set_compared(compared_prep);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
	@Test
	public void test3()
	{
		String origin = "behind";
		String origin2 = "since";
		String compare = "behind";
		String compare2 = "since";
		origin_prep.input(origin);
		origin_prep.input(origin2);
		compared_prep.input(compare);
		compared_prep.input(compare2);
		comparer.set_origin(origin_prep);
		comparer.set_compared(compared_prep);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,2);
	}
	@Test
	public void test4()
	{
		String origin = "behind";
		String origin2 = "since";
		String compare = "behind";
		String compare2 = "against";
		origin_prep.input(origin);
		origin_prep.input(origin2);
		compared_prep.input(compare);
		compared_prep.input(compare2);
		comparer.set_origin(origin_prep);
		comparer.set_compared(compared_prep);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test5()
	{
		String origin = "behind";
		String origin2 = "against";
		String compare = "within";
		String compare2 = "since";
		origin_prep.input(origin);
		origin_prep.input(origin2);
		compared_prep.input(compare);
		compared_prep.input(compare2);
		comparer.set_origin(origin_prep);
		comparer.set_compared(compared_prep);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
}
